Einhugur Xml Serialization Framework for Einhugur Xml Plugin

XmlSerializer.Serialize Method

Serialises a class structure

shared Serialize(
   item as Object,
   rootName as String) as EinhugurXml.Document

Parameters

item
The item to be serialized
rootName
name of the root.

Returns

EinhugurXml.Document
Returns EinhugurXml.Document with the serialised class structure.

Remarks

All classes that are serialized must have a default constructor that has no parameters.


// Serialize our data
// ------------------------------------------------------------------
var xmlDoc as EinhugurXml.Document = XmlSerialization.XmlSerializer.Serialize(facility1,"Facility")
// ------------------------------------------------------------------

// In this example then Facility was complex Xojo class with the following structure:
// Facility
// -> Address as Address
// ——> City as String
// ——> Country as String
// ——> PostalCode as String
// ——> State as String
// ——> Street as String
// -> Customers() as Customer
// ——> ID as String
// ——> CreditLimit as Integer
// ——> FirstName as String
// ——> MiddleName as String
// ——> LastName as String
// ——> ShippingAddresses() as Address
// ————> City as String
// ————> Country as String
// ————> PostalCode as String
// ————> State as String
// ————> Street as String
// -> Employees() as Employee
// ——> D as String
// ——> DateOfBirth as DateTime
// ——> FirstName as String
// ——> MiddleName as String
// ——> LastName as String

See Also

XmlSerializer Class